In [ ]:
import plotly.graph_objs as go
In [ ]:
import numpy as np
In [16]:
lat = 22.2973142
lon = 73.1942567
In [80]:
fig= go.Figure(go.Scattergeo(
lat=[lat],
lon=[lon],
mode='markers',
marker_color='red',
marker_size=10,
))
fig.update_layout(
width=1000, height=800,
geo=dict(
center_lon=lon,
center_lat=lat,
projection_rotation_lon=lon,
projection_rotation_lat=lat,
showland=True,
showcountries=True,
landcolor='#99BBFF',
countrycolor='#000000'
)
)
fig.show()
In [1]:
#Sphere Earth Visualization projectiontype='orthographic
In [78]:
import plotly.graph_objects as go
lat = 22.2973142
lon = 73.1942567
fig = go.Figure(go.Scattergeo(
lat=[lat],
lon=[lon],
mode='markers',
marker=dict(
color='red',
size=10
),
))
fig.update_layout(
width=600, height=600,
geo=dict(
projection_type='orthographic',
center=dict(lat=lat, lon=lon),
projection=dict(rotation=dict(lon=lon)),
projection_scale=0.9,
showland=True,
showcountries=True,
landcolor='#99BBFF',
countrycolor='#000000'
)
)
fig.show()
In [4]:
#albers
In [11]:
import plotly.graph_objects as go
# Coordinates
lat = 22.2973142
lon = 73.1942567
fig = go.Figure(go.Scattergeo(
lat=[lat],
lon=[lon],
mode='markers',
marker=dict(
color='red',
size=10
)
))
# Update layout with correct projection settings
fig.update_layout(
width=600, height=600,
geo=dict(
projection_type='orthographic',
center=dict(lon=lon, lat=lat),
projection_rotation=dict(lon=lon, lat=lat),
projection_scale=1.5, # Adjust scale as needed
showland=True,
showcountries=True,
landcolor='#99BBFF',
countrycolor='#000000'
)
)
fig.show()
In [13]:
#Animation on 🌎
In [19]:
import plotly.graph_objects as go
import numpy as np
lat = 22.2973142
lon = 73.1942567
fig = go.Figure(go.Scattergeo(
lat=[lat],
lon=[lon],
mode='markers',
marker=dict(color='red', size=10)
))
fig.update_layout(
width=600, height=600,
geo=dict(
projection_type='orthographic',
center=dict(lat=lat, lon=lon),
projection_rotation=dict(lat=lat, lon=lon),
projection_scale=0.9,
showland=True,
showcountries=True,
landcolor='#99BBFF',
countrycolor='#000000'
),
updatemenus=[
dict(
type='buttons',
showactive=False,
y=1,
x=1,
xanchor='right',
yanchor='top',
pad=dict(t=0, r=10),
buttons=[
dict(
label='Rotating Btn',
method='animate',
args=[
None,
dict(
frame=dict(duration=20, redraw=True),
transition=dict(duration=0),
fromcurrent=True,
mode='immediate'
)
]
)
]
)
]
)
lon_range = np.arange(lon, 360 + lon, 2)
frames = [go.Frame(layout=dict(geo=dict(center=dict(lon=l), projection_rotation=dict(lon=l)))) for l in lon_range]
fig.update(frames=frames)
fig.show()
In [21]:
#natural Cat shape earth
In [23]:
lat = 22.2973142
lon = 73.1942567
fig= go.Figure(go.Scattergeo(
lat=[lat],
lon=[lon],
mode='markers',
marker_color='red',
marker_size=10,
))
fig.update_layout(
width=600, height=600,
geo=dict(
projection_type='natural earth',
center_lon=100+lon,
center_lat=0,
projection_rotation_lon=100+lon,
projection_scale=0.9,
showland=True,
showcountries=True,
landcolor='#99BBFF',
countrycolor='#000000'
)
)
fig.show()
In [25]:
#aitoff on 🐀
In [27]:
import plotly.graph_objects as go
lat = 22.2973142
lon = 73.1942567
# Create a Scattergeo plot with the "aitoff" projection type
fig = go.Figure(go.Scattergeo(
lat=[lat],
lon=[lon],
mode='markers',
marker=dict(color='red', size=10),
))
fig.update_layout(
width=600, height=600,
geo=dict(
projection_type='aitoff',
center_lon=100 + lon,
center_lat=0,
projection_rotation_lon=100 + lon,
projection_scale=0.9,
showland=True,
showcountries=True,
landcolor='#99BBFF',
countrycolor='#000000'
)
)
fig.show()
In [29]:
#mt flat polar quartic
In [31]:
import plotly.graph_objects as go
lat = 22.2973142
lon = 73.1942567
fig = go.Figure(go.Scattergeo(
lat=[lat],
lon=[lon],
mode='markers',
marker=dict(color='red', size=10),
))
fig.update_layout(
width=600, height=600,
geo=dict(
projection_type='mt flat polar quartic',
center_lon=100 + lon,
center_lat=0,
projection_rotation_lon=100 + lon,
projection_scale=0.9,
showland=True,
showcountries=True,
landcolor='#99BBFF',
countrycolor='#000000'
)
)
fig.show()
In [33]:
#Nell hammer
In [35]:
import plotly.graph_objects as go
lat = 22.2973142
lon = 73.1942567
# Create a Scattergeo plot with the "nell hammer" projection type
fig = go.Figure(go.Scattergeo(
lat=[lat],
lon=[lon],
mode='markers',
marker=dict(color='red', size=10),
))
fig.update_layout(
width=600, height=600,
geo=dict(
projection_type='nell hammer',
center_lon=100 + lon,
center_lat=0,
projection_rotation_lon=100 + lon,
projection_scale=0.9,
showland=True,
showcountries=True,
landcolor='#99BBFF',
countrycolor='#000000'
)
)
fig.show()
In [37]:
#satellite
In [39]:
import plotly.graph_objects as go
lat = 22.2973142
lon = 73.1942567
fig = go.Figure(go.Scattergeo(
lat=[lat],
lon=[lon],
mode='markers',
marker=dict(color='red', size=10),
))
fig.update_layout(
width=600, height=600,
geo=dict(
projection_type='satellite',
center_lon=100 + lon,
center_lat=0,
projection_rotation_lon=100 + lon,
projection_scale=0.9,
showland=True,
showcountries=True,
landcolor='#99BBFF',
countrycolor='#000000'
)
)
fig.show()
In [41]:
#orthographic projection type for a 3D-like globe
In [43]:
import plotly.graph_objects as go
lat = 22.2973142
lon = 73.1942567
fig = go.Figure(go.Scattergeo(
lat=[lat],
lon=[lon],
mode='markers',
marker=dict(color='red', size=10),
))
fig.update_layout(
width=800, height=800,
geo=dict(
projection_type='orthographic', # Use orthographic for a spherical look
center_lon=lon,
center_lat=lat,
projection_rotation_lon=lon,
projection_rotation_lat=lat,
showland=True,
showcountries=True,
landcolor='#99BBFF',
countrycolor='#000000',
showocean=True,
oceancolor='#E5F5FF',
),
margin=dict(l=0, r=0, t=0, b=0),
)
# Enable zoom and rotate
fig.update_geos(
resolution=50,
showcoastlines=True, coastlinecolor="Black",
showland=True, landcolor="LightGreen",
showocean=True, oceancolor="LightBlue",
showcountries=True, countrycolor="Black",
projection_scale=0.8, # Zoom in
)
fig.show()
In [45]:
#orthographic :flight position
In [47]:
import plotly.graph_objects as go
lat = 22.2973142
lon = 73.1942567
fig = go.Figure(go.Scattergeo(
lat=[lat],
lon=[lon],
mode='markers',
marker=dict(color='red', size=10, symbol='circle'), # Changed symbol to 'circle'
text='Flight Position',
))
fig.update_layout(
width=800, height=800,
geo=dict(
projection_type='orthographic', # Use orthographic for a spherical look
center_lon=lon, # Center around the given longitude
center_lat=lat, # Center around the given latitude
projection_rotation_lon=lon,
projection_rotation_lat=lat,
projection_scale=4.5, # Zoom in on India
showland=True,
showcountries=True,
landcolor='#99BBFF',
countrycolor='#000000',
showocean=True,
oceancolor='#E5F5FF',
lonaxis=dict(range=[65, 100]), # Limit longitude range to focus on India
lataxis=dict(range=[5, 40]), # Limit latitude range to focus on India
),
margin=dict(l=0, r=0, t=0, b=0),
)
fig.show()
In [49]:
#orthographic:Vadodara (Gujarat) and Mumbai and
In [51]:
import plotly.graph_objects as go
# Coordinates
vadodara_lat, vadodara_lon = 22.2973142, 73.1942567
mumbai_lat, mumbai_lon = 19.0760, 72.8777
fig = go.Figure()
# flight path from Vadodara to Mumbai
fig.add_trace(go.Scattergeo(
lat=[vadodara_lat, mumbai_lat],
lon=[vadodara_lon, mumbai_lon],
mode='lines+markers+text',
line=dict(width=2, color='gray'),
marker=dict(size=10, symbol='triangle-up', color='red'), # Use 'triangle-up' as flight symbol
text=['Vadodara', 'Mumbai'], # Add location names
textposition="top center"
))
# marker 🌟 star
fig.add_trace(go.Scattergeo(
lat=[vadodara_lat, mumbai_lat],
lon=[vadodara_lon, mumbai_lon],
mode='markers',
marker=dict(size=12, symbol='star', color='orange'),
text=['Vadodara Flag', 'Mumbai Flag'],
textposition="bottom center"
))
# layout globe view
fig.update_layout(
width=800, height=800,
geo=dict(
projection_type='orthographic', # Spherical globe projection
center_lon=73, # Centered around the approximate midpoint
center_lat=20.5,
projection_rotation_lon=73,
projection_rotation_lat=20.5,
projection_scale=4.5, # Zoom in to show India clearly
showland=True,
showcountries=True,
landcolor='#99BBFF',
countrycolor='#000000',
showocean=True,
oceancolor='#E5F5FF',
lonaxis=dict(range=[65, 80]), # Focus on Western India
lataxis=dict(range=[15, 25]), # Focus on Western India
),
margin=dict(l=0, r=0, t=0, b=0),
title='Flight Path from Vadodara to Mumbai'
)
fig.show()
In [53]:
#conic conforma
In [55]:
import plotly.graph_objects as go
# Coordinates
vadodara_lat, vadodara_lon = 22.2973142, 73.1942567
mumbai_lat, mumbai_lon = 19.0760, 72.8777
fig = go.Figure()
# path
fig.add_trace(go.Scattergeo(
lat=[vadodara_lat, mumbai_lat],
lon=[vadodara_lon, mumbai_lon],
mode='lines+markers+text',
line=dict(width=2, color='blue'),
marker=dict(size=10, symbol='triangle-up', color='red'), # Use 'triangle-up' as flight symbol
text=['Vadodara', 'Mumbai'], # Add location names
textposition="top center"
))
# flag marker
fig.add_trace(go.Scattergeo(
lat=[vadodara_lat, mumbai_lat],
lon=[vadodara_lon, mumbai_lon],
mode='markers',
marker=dict(size=14, symbol='star', color='orange'), # Indian flag approximation
text=['Vadodara Flag', 'Mumbai Flag'],
textposition="bottom center"
))
# conic conforma
fig.update_layout(
width=800, height=800,
geo=dict(
projection_type='conic conformal',
center_lon=(vadodara_lon + mumbai_lon) / 2,
center_lat=(vadodara_lat + mumbai_lat) / 2,
projection_scale=5.0, # Adjust scale as needed
showland=True,
showcountries=True,
landcolor='#99BBFF',
countrycolor='#000000',
showocean=True,
oceancolor='#E5F5FF',
lonaxis=dict(range=[65, 80]), # Focus on Western India
lataxis=dict(range=[15, 25]), # Focus on Western India
),
margin=dict(l=0, r=0, t=0, b=0),
title='Flight Path from Vadodara to Mumbai'
)
fig.show()
In [57]:
#bertin1953 and conic conforma
In [59]:
import plotly.graph_objects as go
# Coordinates
mumbai_lat, mumbai_lon = 19.0760, 72.8777
fig = go.Figure()
fig.add_trace(go.Scattergeo(
lat=[mumbai_lat],
lon=[mumbai_lon],
mode='markers+text',
marker=dict(size=14, symbol='star', color='red'), # Use 'star' to mark Mumbai
text=['Mumbai'],
textposition="bottom center"
))
# for the Bertin 1953 conic conforma
fig.update_layout(
width=800, height=800,
geo=dict(
projection_type='conic conformal', # Use conic conformal projection
projection_scale=5.0, # Adjust scale as needed
center_lon=mumbai_lon,
center_lat=mumbai_lat,
showland=True,
showcountries=True,
landcolor='#99BBFF',
countrycolor='#000000',
showocean=True,
oceancolor='#E5F5FF',
),
margin=dict(l=0, r=0, t=0, b=0),
title='Mumbai Location on Bertin 1953 Conic Conformal Projection'
)
fig.show()
In [61]:
#foucaut sinusoidal
In [63]:
import plotly.graph_objects as go
mumbai_lat, mumbai_lon = 19.0760, 72.8777
fig = go.Figure(go.Scattergeo(
lat=[mumbai_lat],
lon=[mumbai_lon],
mode='markers',
marker=dict(color='red', size=10),
))
fig.update_layout(
width=600, height=600,
geo=dict(
projection_type='foucaut sinusoidal',
center_lon=mumbai_lon,
center_lat=mumbai_lat,
projection_rotation_lon=mumbai_lon,
projection_scale=0.9,
showland=True,
showcountries=True,
landcolor='#99BBFF',
countrycolor='#000000'
)
)
fig.show()
In [65]:
# times
In [67]:
import plotly.graph_objects as go
mumbai_lat, mumbai_lon = 19.0760, 72.8777
fig = go.Figure(go.Scattergeo(
lat=[mumbai_lat],
lon=[mumbai_lon],
mode='markers',
marker=dict(color='red', size=10),
))
fig.update_layout(
width=600, height=600,
geo=dict(
projection_type='times',
center_lon=mumbai_lon,
center_lat=mumbai_lat,
projection_rotation_lon=mumbai_lon,
projection_scale=0.9,
showland=True,
showcountries=True,
landcolor='#99BBFF',
countrycolor='#000000'
)
)
fig.show()
In [69]:
#winkel tripe
In [71]:
import plotly.graph_objects as go
mumbai_lat, mumbai_lon = 19.0760, 72.8777
fig = go.Figure(go.Scattergeo(
lat=[mumbai_lat],
lon=[mumbai_lon],
mode='markers',
marker=dict(color='red', size=10),
))
fig.update_layout(
width=600, height=600,
geo=dict(
projection_type='winkel tripel',
center_lon=mumbai_lon,
center_lat=mumbai_lat,
projection_rotation_lon=mumbai_lon,
projection_scale=0.9,
showland=True,
showcountries=True,
landcolor='#99BBFF',
countrycolor='#000000'
)
)
fig.show()
In [73]:
# combine multiple visualize like parabolic", "mt flat polar quartic", "mt flat polar sinusoidal",
# "natural earth", "natural earth1", "natural earth2",
# "nell hammer", "nicolosi", "orthographic", "patterson",
# "peirce quincuncial", "polyconic"
In [84]:
import plotly.graph_objects as go
from plotly.subplots import make_subplots
# Latitude and Longitude for Mumbai
mumbai_lat, mumbai_lon = 19.0760, 72.8777
# Define valid projections to visualize
projections = [
"mt flat polar quartic", "mt flat polar sinusoidal",
"natural earth", "natural earth1", "natural earth2",
"nell hammer", "nicolosi", "orthographic", "patterson",
"peirce quincuncial", "polyconic"
]
# Create subplots
fig = make_subplots(
rows=4, cols=3,
subplot_titles=projections,
specs=[[{'type': 'scattergeo'}]*3]*4
)
# Add plots for each projection
for i, projection in enumerate(projections):
row = i // 3 + 1
col = i % 3 + 1
fig.add_trace(go.Scattergeo(
lat=[mumbai_lat],
lon=[mumbai_lon],
mode='markers',
marker=dict(color='red', size=10),
), row=row, col=col)
fig.update_geos(
projection_type=projection,
center_lon=mumbai_lon,
center_lat=mumbai_lat,
projection_rotation_lon=mumbai_lon,
projection_scale=0.9,
showland=True,
showcountries=True,
landcolor='#99BBFF',
countrycolor='#000000',
row=row,
col=col
)
fig.update_layout(
height=1200,
width=900,
title_text="Different Map Projections Centered on Mumbai",
showlegend=False
)
fig.show()
In [ ]:
In [ ]: